package com.sxw.hw_student.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sxw.hw_student.system.entity.Teacher;
import com.sxw.hw_student.system.mapper.TeacherMapper;
import com.sxw.hw_student.system.service.ITeacherService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> implements ITeacherService {

    private final TeacherMapper teacherMapper;

    public TeacherServiceImpl(TeacherMapper teacherMapper) {
        this.teacherMapper = teacherMapper;
    }

    @Override
    public List<Teacher> getAllTeachers() {
        return teacherMapper.selectList(null);
    }

    @Override
    public boolean updateTeacher(Teacher teacher) {
        return teacherMapper.updateById(teacher) > 0;
    }

    @Override
    public boolean deleteTeacherById(Integer teacherNo) {
        return teacherMapper.deleteById(teacherNo) > 0;
    }
}
